home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / language / isetl.arc / object.t < prev    next >
Text File  |  1987-08-20  |  486b  |  20 lines

  1.    make_account :=
  2.     func(name, balance);
  3.     return 
  4.     {
  5.         ["deposit", func(n); balance := balance + n; end],
  6.         ["withdraw", func(n); balance := balance - n; end],
  7.         ["balance", func(); return balance; end],
  8.         ["name", func(); return name; end]
  9.     };
  10.     end;
  11.  
  12.    gary := make_account("Gary Levin", 1000);
  13.    carol := make_account("Carol Simon Levin", 1000);
  14. gary("name")();
  15. carol("name")();
  16. gary("deposit")(100);
  17. carol("withdraw")(300);
  18. gary("balance")();
  19. carol("balance")();
  20.